package com.bang.service.impl;

import com.bang.pojo.Role;
import com.bang.mapper.RoleMapper;
import com.bang.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: bangbang
 * @Date: 2019/11/14 19:04
 */
@Service
public class RoleServiceImpl implements IRoleService {

    @Autowired
    private RoleMapper roleMapper;

    @Override
    public List<String> queryRolesByUserId(Integer userId) {
        List<Role> list = roleMapper.queryRolesByUserId(userId);
        List<String> roles = new ArrayList<String>();
        for (Role role : list) {
            roles.add(role.getRolename());
        }
        return roles;

    }
}
